package com.shopReduce.dao;


import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

import com.shopReduce.bean.ReduceProgramme;
import com.shopReduce.bean.ShopReduce;
import com.shopReduce.sql.ReduceProgrammeBuilder;
import com.shopReduce.sql.ShopReduceBuilder;


@Mapper
public interface ShopReduceMapper {

	
	@Insert("insert into sys_shop_reduce set id=#{id},sort=#{sort},shopId=#{shopId},reduceId=#{reduceId},createDate=#{createDate},expireDate=#{expireDate},beginDate=#{beginDate}")
	public int insert(ShopReduce shopReduce);
	
	@Select("select * from sys_shop_reduce where shopId=#{shopId} and reduceId=#{reduceId}")
	public ShopReduce getByShopIdAndReduceId(@Param("shopId")String shopId,@Param("reduceId")String reduceId);
	
	@Delete("delete from  sys_shop_reduce where id=#{id}")
	public int deleteById(String id);
	
	
	@Update("update  sys_shop_reduce set id=#{id},shopId=#{shopId},reduceId=#{reduceId},createDate=#{createDate},expireDate=#{expireDate},beginDate=#{beginDate} where id=#{id}")
	public int updateById(ShopReduce shopReduce);
	
	@SelectProvider(type=ShopReduceBuilder.class,method="listCount")
	public long listCount(ShopReduce search);
	@SelectProvider(type=ShopReduceBuilder.class,method="list")
	public List<ShopReduce> list(ShopReduce search);
	
	
	@Select("SELECT  * from  sys_shop_reduce where id=#{id}")
	public ShopReduce get(String id);
}
